/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'central';
  
  checkConfig(config);
  @endpoint = getEndpoint('foasconsole', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ConvertInstanceRequest {
  convertPostpayInstanceRequest?: {
    duration?: int32(name='Duration', example='1'),
    instanceId?: string(name='InstanceId', example='sc_flinkserverlesspost_public_cn-*******'),
    isAutoRenew?: boolean(name='IsAutoRenew', example='true'),
    namespaceResourceSpecs?: [ 
      {
        namespace?: string(name='Namespace', example='ns-1'),
        resourceSpec?: {
          cpu?: int32(name='Cpu', example='1'),
          memoryGB?: int32(name='MemoryGB', example='4'),
        }(name='ResourceSpec'),
      }
    ](name='NamespaceResourceSpecs'),
    pricingCycle?: string(name='PricingCycle', example='Month'),
    region?: string(name='Region', example='cn-beijing'),
  }(name='ConvertPostpayInstanceRequest'),
}

model ConvertInstanceResponseBody = {
  orderId?: long(name='OrderId', example='211473228320700'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model ConvertInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ConvertInstanceResponseBody(name='body'),
}

async function convertInstanceWithOptions(request: ConvertInstanceRequest, runtime: Util.RuntimeOptions): ConvertInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.convertPostpayInstanceRequest)) {
    bodyFlat['ConvertPostpayInstanceRequest'] = request.convertPostpayInstanceRequest;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ConvertInstance',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function convertInstance(request: ConvertInstanceRequest): ConvertInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return convertInstanceWithOptions(request, runtime);
}

model ConvertPrepayInstanceRequest {
  convertPrepayInstanceRequest?: {
    instanceId?: string(name='InstanceId'),
    region?: string(name='Region'),
  }(name='ConvertPrepayInstanceRequest'),
}

model ConvertPrepayInstanceResponseBody = {
  orderId?: long(name='OrderId'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success'),
}

model ConvertPrepayInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ConvertPrepayInstanceResponseBody(name='body'),
}

async function convertPrepayInstanceWithOptions(request: ConvertPrepayInstanceRequest, runtime: Util.RuntimeOptions): ConvertPrepayInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.convertPrepayInstanceRequest)) {
    bodyFlat['ConvertPrepayInstanceRequest'] = request.convertPrepayInstanceRequest;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ConvertPrepayInstance',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function convertPrepayInstance(request: ConvertPrepayInstanceRequest): ConvertPrepayInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return convertPrepayInstanceWithOptions(request, runtime);
}

model CreateInstanceRequest {
  createInstanceRequest?: {
    architectureType?: string(name='ArchitectureType'),
    autoRenew?: boolean(name='AutoRenew', example='true'),
    chargeType?: string(name='ChargeType', example='PRE'),
    duration?: int32(name='Duration', example='1'),
    extra?: string(name='Extra', example='*'),
    ha?: boolean(name='Ha'),
    haResourceSpec?: {
      cpu?: int32(name='Cpu'),
      memoryGB?: int32(name='MemoryGB'),
    }(name='HaResourceSpec'),
    haVSwitchIds?: [ string ](name='HaVSwitchIds'),
    haZoneId?: string(name='HaZoneId'),
    instanceName?: string(name='InstanceName', example='vvp1'),
    monitorType?: string(name='MonitorType'),
    pricingCycle?: string(name='PricingCycle', example='Month'),
    promotionCode?: string(name='PromotionCode', example='5RT******'),
    region?: string(name='Region', example='cn-beijing'),
    resourceGroupId?: string(name='ResourceGroupId', example='rg-******'),
    resourceSpec?: {
      cpu?: int32(name='Cpu', example='10'),
      memoryGB?: int32(name='MemoryGB', example='40'),
    }(name='ResourceSpec'),
    storage?: {
      oss?: {
        bucket?: string(name='Bucket', example='oss_flink'),
      }(name='Oss'),
    }(name='Storage'),
    usePromotionCode?: boolean(name='UsePromotionCode', example='true'),
    vSwitchIds?: [ string ](name='VSwitchIds'),
    vpcId?: string(name='VpcId', description='VPC ID。', example='vpc-2ze9*******nxfmfcdi'),
    zoneId?: string(name='ZoneId', example='cn-beijing-g'),
  }(name='CreateInstanceRequest'),
}

model CreateInstanceResponseBody = {
  orderInfo?: {
    instanceId?: string(name='InstanceId', example='8D2D5BBF-C302-1A21-80E1-27799802****'),
    orderId?: long(name='OrderId', example='210406354694567'),
  }(name='OrderInfo'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model CreateInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateInstanceResponseBody(name='body'),
}

async function createInstanceWithOptions(request: CreateInstanceRequest, runtime: Util.RuntimeOptions): CreateInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.createInstanceRequest)) {
    bodyFlat['CreateInstanceRequest'] = request.createInstanceRequest;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateInstance',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createInstance(request: CreateInstanceRequest): CreateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createInstanceWithOptions(request, runtime);
}

model CreateNamespaceRequest {
  createNamespaceRequest?: {
    ha?: boolean(name='Ha'),
    instanceId?: string(name='InstanceId', example='223493C7-FCA9-13D4-B75B-AF8B32F4****'),
    namespace?: string(name='Namespace', example='ns-1'),
    region?: string(name='Region', example='cn-beijing'),
    resourceSpec?: {
      cpu?: int32(name='Cpu', example='10'),
      memoryGB?: int32(name='MemoryGB', example='40'),
    }(name='ResourceSpec'),
  }(name='CreateNamespaceRequest'),
}

model CreateNamespaceResponseBody = {
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model CreateNamespaceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateNamespaceResponseBody(name='body'),
}

async function createNamespaceWithOptions(request: CreateNamespaceRequest, runtime: Util.RuntimeOptions): CreateNamespaceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.createNamespaceRequest)) {
    bodyFlat['CreateNamespaceRequest'] = request.createNamespaceRequest;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateNamespace',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createNamespace(request: CreateNamespaceRequest): CreateNamespaceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createNamespaceWithOptions(request, runtime);
}

model DeleteInstanceRequest {
  deleteInstanceRequest?: {
    instanceId?: string(name='InstanceId', example='223493C7-FCA9-13D4-B75B-AF8B32F4****'),
    region?: string(name='Region', example='cn-beijing'),
  }(name='DeleteInstanceRequest'),
}

model DeleteInstanceResponseBody = {
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model DeleteInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteInstanceResponseBody(name='body'),
}

async function deleteInstanceWithOptions(request: DeleteInstanceRequest, runtime: Util.RuntimeOptions): DeleteInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.deleteInstanceRequest)) {
    bodyFlat['DeleteInstanceRequest'] = request.deleteInstanceRequest;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteInstance',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteInstance(request: DeleteInstanceRequest): DeleteInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteInstanceWithOptions(request, runtime);
}

model DeleteNamespaceRequest {
  deleteNamespaceRequest?: {
    instanceId?: string(name='InstanceId', example='sc_flinkserverlesspost_public_cn-0ju2bj2****'),
    namespace?: string(name='Namespace', example='ns-1'),
    region?: string(name='Region', example='cn-beijing'),
  }(name='DeleteNamespaceRequest'),
}

model DeleteNamespaceResponseBody = {
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model DeleteNamespaceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteNamespaceResponseBody(name='body'),
}

async function deleteNamespaceWithOptions(request: DeleteNamespaceRequest, runtime: Util.RuntimeOptions): DeleteNamespaceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.deleteNamespaceRequest)) {
    bodyFlat['DeleteNamespaceRequest'] = request.deleteNamespaceRequest;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteNamespace',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteNamespace(request: DeleteNamespaceRequest): DeleteNamespaceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteNamespaceWithOptions(request, runtime);
}

model DescribeInstancesRequest {
  describeInstancesRequest?: {
    architectureType?: string(name='ArchitectureType'),
    chargeType?: string(name='ChargeType', example='PRE'),
    instanceId?: string(name='InstanceId', example='223493C7-FCA9-13D4-B75B-AF8B32F4****'),
    pageIndex?: int32(name='PageIndex', example='1'),
    pageSize?: int32(name='PageSize', example='2'),
    region?: string(name='Region', example='cn-beijing'),
    resourceGroupId?: string(name='ResourceGroupId', example='rg-***'),
    tags?: [ 
      {
        key?: string(name='Key', example='flink'),
        value?: string(name='Value', example='test'),
      }
    ](name='Tags'),
  }(name='DescribeInstancesRequest'),
}

model DescribeInstancesResponseBody = {
  instances?: [ 
    {
      architectureType?: string(name='ArchitectureType'),
      askClusterId?: string(name='AskClusterId', example='c20c******404'),
      chargeType?: string(name='ChargeType', example='PRE'),
      clusterStatus?: string(name='ClusterStatus', example='RUNNING'),
      ha?: boolean(name='Ha'),
      haResourceSpec?: {
        cpu?: int32(name='Cpu'),
        memoryGB?: int32(name='MemoryGB'),
      }(name='HaResourceSpec'),
      haVSwitchIds?: [ string ](name='HaVSwitchIds'),
      haZoneId?: string(name='HaZoneId'),
      hostAliases?: [ 
        {
          hostNames?: [ string ](name='HostNames'),
          ip?: string(name='Ip'),
        }
      ](name='HostAliases'),
      instanceId?: string(name='InstanceId', example='sc_flinkserverlesspost_public_cn-0ju2bj2****'),
      instanceName?: string(name='InstanceName', example='vvp1'),
      monitorType?: string(name='MonitorType'),
      orderState?: string(name='OrderState', example='NORMAL'),
      region?: string(name='Region', example='cn-beijing'),
      resourceCreateTime?: long(name='ResourceCreateTime', example='1629879567394'),
      resourceExpiredTime?: long(name='ResourceExpiredTime', example='1637337600000'),
      resourceGroupId?: string(name='ResourceGroupId', example='rg-***'),
      resourceId?: string(name='ResourceId', example='b3690a1655da47'),
      resourceSpec?: {
        cpu?: int32(name='Cpu', example='10'),
        memoryGB?: int32(name='MemoryGB', example='40'),
      }(name='ResourceSpec'),
      storage?: {
        oss?: {
          bucket?: string(name='Bucket', example='oss_flink'),
        }(name='Oss'),
      }(name='Storage'),
      tags?: [ 
        {
          key?: string(name='Key', example='flink'),
          value?: string(name='Value', example='test'),
        }
      ](name='Tags'),
      uid?: string(name='Uid', example='183899668736****'),
      vSwitchIds?: [ string ](name='VSwitchIds'),
      vpcId?: string(name='VpcId', example='vpc-2ze9*******nxfmfcdi'),
      zoneId?: string(name='ZoneId', example='cn-beijing-g'),
    }
  ](name='Instances'),
  pageIndex?: int32(name='PageIndex', example='1'),
  pageSize?: int32(name='PageSize', example='2'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
  totalCount?: long(name='TotalCount', example='15'),
  totalPage?: int32(name='TotalPage', example='2'),
}

model DescribeInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInstancesResponseBody(name='body'),
}

async function describeInstancesWithOptions(request: DescribeInstancesRequest, runtime: Util.RuntimeOptions): DescribeInstancesResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstances',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeInstances(request: DescribeInstancesRequest): DescribeInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstancesWithOptions(request, runtime);
}

model DescribeNamespacesRequest {
  describeNamespacesRequest?: {
    ha?: boolean(name='Ha'),
    instanceId?: string(name='InstanceId', example='223493C7-FCA9-13D4-B75B-AF8B32F4****'),
    namespace?: string(name='Namespace', example='ns-1'),
    pageIndex?: int32(name='PageIndex', example='1'),
    pageSize?: int32(name='PageSize', example='10'),
    region?: string(name='Region', example='cn-beijing'),
    tags?: [ 
      {
        key?: string(name='Key', example='flink'),
        value?: string(name='Value', example='test'),
      }
    ](name='Tags'),
  }(name='DescribeNamespacesRequest'),
}

model DescribeNamespacesResponseBody = {
  namespaces?: [ 
    {
      gmtCreate?: long(name='GmtCreate', example='1629879567394'),
      gmtModified?: long(name='GmtModified', example='1629879567394'),
      ha?: boolean(name='Ha'),
      namespace?: string(name='Namespace', example='ns-1'),
      resourceSpec?: {
        cpu?: int32(name='Cpu', example='10'),
        memoryGB?: int32(name='MemoryGB', example='40'),
      }(name='ResourceSpec'),
      resourceUsed?: {
        cpu?: float(name='Cpu', example='2.5'),
        cu?: float(name='Cu', example='1.6'),
        memoryGB?: float(name='MemoryGB', example='6.6'),
      }(name='ResourceUsed'),
      status?: string(name='Status', example='SUCCESS'),
      tags?: [ 
        {
          key?: string(name='Key', example='flink'),
          value?: string(name='Value', example='test'),
        }
      ](name='Tags'),
    }
  ](name='Namespaces'),
  pageIndex?: int32(name='PageIndex', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
  totalCount?: long(name='TotalCount', example='15'),
  totalPage?: int32(name='TotalPage', example='2'),
}

model DescribeNamespacesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeNamespacesResponseBody(name='body'),
}

async function describeNamespacesWithOptions(request: DescribeNamespacesRequest, runtime: Util.RuntimeOptions): DescribeNamespacesResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeNamespaces',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeNamespaces(request: DescribeNamespacesRequest): DescribeNamespacesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeNamespacesWithOptions(request, runtime);
}

model DescribeSupportedRegionsResponseBody = {
  regions?: [ 
    {
      region?: string(name='Region', example='cn-beijing'),
      regionName?: string(name='RegionName', example='华北2 (北京)'),
    }
  ](name='Regions'),
  requestId?: string(name='RequestId', example='B21DC47E-8928-199A-9F32-36D45E4693B4'),
  success?: boolean(name='Success', example='true'),
}

model DescribeSupportedRegionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSupportedRegionsResponseBody(name='body'),
}

async function describeSupportedRegionsWithOptions(runtime: Util.RuntimeOptions): DescribeSupportedRegionsResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'DescribeSupportedRegions',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeSupportedRegions(): DescribeSupportedRegionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSupportedRegionsWithOptions(runtime);
}

model DescribeSupportedZonesRequest {
  architectureType?: string(name='ArchitectureType'),
  region?: string(name='Region', example='cn-beijing'),
}

model DescribeSupportedZonesResponseBody = {
  requestId?: string(name='RequestId', example='23A9C718-DDAB-1696-B025-18FBC830F7C5'),
  success?: boolean(name='Success', example='true'),
  zoneIds?: [ string ](name='ZoneIds'),
}

model DescribeSupportedZonesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSupportedZonesResponseBody(name='body'),
}

async function describeSupportedZonesWithOptions(request: DescribeSupportedZonesRequest, runtime: Util.RuntimeOptions): DescribeSupportedZonesResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSupportedZones',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeSupportedZones(request: DescribeSupportedZonesRequest): DescribeSupportedZonesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSupportedZonesWithOptions(request, runtime);
}

model ListTagResourcesRequest {
  nextToken?: string(name='NextToken', example='yt656'),
  regionId?: string(name='RegionId', example='cn-beijing'),
  resourceId?: [ string ](name='ResourceId'),
  resourceType?: string(name='ResourceType', example='vvpinstance'),
  tag?: [ 
    {
      key?: string(name='Key', example='test'),
      value?: string(name='Value', example='tag'),
    }
  ](name='Tag'),
}

model ListTagResourcesResponseBody = {
  nextToken?: string(name='NextToken', example='27AE00'),
  requestId?: string(name='RequestId', description='requestID。', example='27AE00'),
  success?: boolean(name='Success', example='true'),
  tagReponseId?: string(name='TagReponseId', example='87AE00'),
  tagResources?: [ 
    {
      resourceId?: string(name='ResourceId', example='f-cn-tyts'),
      resourceType?: string(name='ResourceType', example='vvpinstance'),
      tagKey?: string(name='TagKey', example='test'),
      tagValue?: string(name='TagValue', example='tag'),
    }
  ](name='TagResources'),
}

model ListTagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagResourcesResponseBody(name='body'),
}

async function listTagResourcesWithOptions(request: ListTagResourcesRequest, runtime: Util.RuntimeOptions): ListTagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTagResources',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listTagResources(request: ListTagResourcesRequest): ListTagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagResourcesWithOptions(request, runtime);
}

model ModifyPrepayInstanceSpecRequest {
  modifyPrepayInstanceSpecRequest?: {
    ha?: boolean(name='Ha'),
    haResourceSpec?: {
      cpu?: int32(name='Cpu'),
      memoryGB?: int32(name='MemoryGB'),
    }(name='HaResourceSpec'),
    haVSwitchIds?: [ string ](name='HaVSwitchIds'),
    haZoneId?: string(name='HaZoneId'),
    instanceId?: string(name='InstanceId', example='sc_flinkserverlesspost_public_cn-0ju2bj2i104'),
    region?: string(name='Region', example='cn-beijing'),
    resourceSpec?: {
      cpu?: int32(name='Cpu', example='10'),
      memoryGB?: int32(name='MemoryGB', example='40'),
    }(name='ResourceSpec'),
  }(name='ModifyPrepayInstanceSpecRequest'),
}

model ModifyPrepayInstanceSpecResponseBody = {
  orderId?: long(name='OrderId', example='210406354690749'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model ModifyPrepayInstanceSpecResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyPrepayInstanceSpecResponseBody(name='body'),
}

/**
  * @deprecated : ModifyPrepayInstanceSpec is deprecated, please use foasconsole::2019-06-01::ModifyInstanceSpec instead.
  *
  * @param request ModifyPrepayInstanceSpecRequest
  * @param runtime runtime options for this request RuntimeOptions
  * @return ModifyPrepayInstanceSpecResponse
 */
// Deprecated
async function modifyPrepayInstanceSpecWithOptions(request: ModifyPrepayInstanceSpecRequest, runtime: Util.RuntimeOptions): ModifyPrepayInstanceSpecResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.modifyPrepayInstanceSpecRequest)) {
    bodyFlat['ModifyPrepayInstanceSpecRequest'] = request.modifyPrepayInstanceSpecRequest;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyPrepayInstanceSpec',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * @deprecated : ModifyPrepayInstanceSpec is deprecated, please use foasconsole::2019-06-01::ModifyInstanceSpec instead.
  *
  * @param request ModifyPrepayInstanceSpecRequest
  * @return ModifyPrepayInstanceSpecResponse
 */
// Deprecated
async function modifyPrepayInstanceSpec(request: ModifyPrepayInstanceSpecRequest): ModifyPrepayInstanceSpecResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPrepayInstanceSpecWithOptions(request, runtime);
}

model ModifyPrepayNamespaceSpecRequest {
  modifyPrepayNamespaceSpecRequest?: {
    instanceId?: string(name='InstanceId', example='sc_flinkserverlesspost_public_cn-0ju2bj2****'),
    namespace?: string(name='Namespace', example='ns-1'),
    region?: string(name='Region', example='cn-beijing'),
    resourceSpec?: {
      cpu?: int32(name='Cpu', example='10'),
      memoryGB?: int32(name='MemoryGB', example='40'),
    }(name='ResourceSpec'),
  }(name='ModifyPrepayNamespaceSpecRequest'),
}

model ModifyPrepayNamespaceSpecResponseBody = {
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model ModifyPrepayNamespaceSpecResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyPrepayNamespaceSpecResponseBody(name='body'),
}

/**
  * @deprecated : ModifyPrepayNamespaceSpec is deprecated, please use foasconsole::2019-06-01::ModifyNamespaceSpec instead.
  *
  * @param request ModifyPrepayNamespaceSpecRequest
  * @param runtime runtime options for this request RuntimeOptions
  * @return ModifyPrepayNamespaceSpecResponse
 */
// Deprecated
async function modifyPrepayNamespaceSpecWithOptions(request: ModifyPrepayNamespaceSpecRequest, runtime: Util.RuntimeOptions): ModifyPrepayNamespaceSpecResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.modifyPrepayNamespaceSpecRequest)) {
    bodyFlat['ModifyPrepayNamespaceSpecRequest'] = request.modifyPrepayNamespaceSpecRequest;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyPrepayNamespaceSpec',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
  * @deprecated : ModifyPrepayNamespaceSpec is deprecated, please use foasconsole::2019-06-01::ModifyNamespaceSpec instead.
  *
  * @param request ModifyPrepayNamespaceSpecRequest
  * @return ModifyPrepayNamespaceSpecResponse
 */
// Deprecated
async function modifyPrepayNamespaceSpec(request: ModifyPrepayNamespaceSpecRequest): ModifyPrepayNamespaceSpecResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPrepayNamespaceSpecWithOptions(request, runtime);
}

model QueryConvertInstancePriceRequest {
  convertPostpayInstanceRequest?: {
    duration?: int32(name='Duration', example='1'),
    instanceId?: string(name='InstanceId', example='sc_flinkserverlesspost_public_cn-******'),
    isAutoRenew?: boolean(name='IsAutoRenew', example='true'),
    namespaceResourceSpecs?: [ 
      {
        namespace?: string(name='Namespace', example='ns-1'),
        resourceSpec?: {
          cpu?: int32(name='Cpu', example='1'),
          memoryGB?: int32(name='MemoryGB', example='4'),
        }(name='ResourceSpec'),
      }
    ](name='NamespaceResourceSpecs'),
    pricingCycle?: string(name='PricingCycle', example='Month'),
    region?: string(name='Region', example='cn-beijing'),
  }(name='ConvertPostpayInstanceRequest'),
}

model QueryConvertInstancePriceResponseBody = {
  priceInfo?: {
    code?: string(name='Code', example='ORDER.INST_HAS_UNPAID_ORDER'),
    currency?: string(name='Currency', example='CNY'),
    depreciateInfo?: {
      cheapRate?: string(name='CheapRate'),
      cheapStandAmount?: string(name='CheapStandAmount'),
      isShow?: boolean(name='IsShow'),
      monthPrice?: string(name='MonthPrice'),
      originalStandAmount?: string(name='OriginalStandAmount'),
      startTime?: string(name='StartTime'),
    }(name='DepreciateInfo'),
    discountAmount?: float(name='DiscountAmount', example='655.2'),
    isContractActivity?: boolean(name='IsContractActivity'),
    message?: string(name='Message', example='存在未支付订单，请先支付或取消原有订单'),
    optionalPromotions?: [ 
      {
        promotionDesc?: string(name='PromotionDesc', example='￥1,391.5 优惠券 (有效期至 03/23/2022)'),
        promotionName?: string(name='PromotionName', example='￥1,391.5 优惠券'),
        promotionOptionNo?: string(name='PromotionOptionNo', example='500011220010099'),
        selected?: boolean(name='Selected', example='true'),
      }
    ](name='OptionalPromotions'),
    originalAmount?: float(name='OriginalAmount', example='4368'),
    rules?: [ 
      {
        description?: string(name='Description', example='买满1年，立享官网价格8.5折优惠。'),
        ruleId?: long(name='RuleId', example='1020071005141834'),
      }
    ](name='Rules'),
    standDiscountPrice?: string(name='StandDiscountPrice'),
    standPrice?: string(name='StandPrice'),
    tradeAmount?: float(name='TradeAmount', example='3712.8'),
  }(name='PriceInfo'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model QueryConvertInstancePriceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryConvertInstancePriceResponseBody(name='body'),
}

async function queryConvertInstancePriceWithOptions(request: QueryConvertInstancePriceRequest, runtime: Util.RuntimeOptions): QueryConvertInstancePriceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.convertPostpayInstanceRequest)) {
    bodyFlat['ConvertPostpayInstanceRequest'] = request.convertPostpayInstanceRequest;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryConvertInstancePrice',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryConvertInstancePrice(request: QueryConvertInstancePriceRequest): QueryConvertInstancePriceResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryConvertInstancePriceWithOptions(request, runtime);
}

model QueryConvertPrepayInstancePriceRequest {
  convertPrepayInstanceRequest?: {
    instanceId?: string(name='InstanceId'),
    region?: string(name='Region'),
  }(name='ConvertPrepayInstanceRequest'),
}

model QueryConvertPrepayInstancePriceResponseBody = {
  priceInfo?: {
    code?: string(name='Code', example='ORDER.INST_HAS_UNPAID_ORDER'),
    currency?: string(name='Currency', example='CNY'),
    depreciateInfo?: {
      cheapRate?: string(name='CheapRate'),
      cheapStandAmount?: string(name='CheapStandAmount'),
      isShow?: boolean(name='IsShow'),
      monthPrice?: string(name='MonthPrice'),
      originalStandAmount?: string(name='OriginalStandAmount'),
      startTime?: string(name='StartTime'),
    }(name='DepreciateInfo'),
    discountAmount?: float(name='DiscountAmount', example='655.2'),
    isContractActivity?: boolean(name='IsContractActivity'),
    message?: string(name='Message', example='存在未支付订单，请先支付或取消原有订单'),
    optionalPromotions?: [ 
      {
        promotionDesc?: string(name='PromotionDesc', example='￥1,391.5 优惠券 (有效期至 03/23/2022)'),
        promotionName?: string(name='PromotionName', example='￥1,391.5 优惠券'),
        promotionOptionNo?: string(name='PromotionOptionNo', example='500011220010099'),
        selected?: boolean(name='Selected'),
      }
    ](name='OptionalPromotions'),
    originalAmount?: float(name='OriginalAmount', example='4368'),
    rules?: [ 
      {
        description?: string(name='Description', example='买满1年，立享官网价格8.5折优惠。'),
        ruleId?: long(name='RuleId', example='587'),
      }
    ](name='Rules'),
    standDiscountPrice?: string(name='StandDiscountPrice'),
    standPrice?: string(name='StandPrice'),
    tradeAmount?: float(name='TradeAmount', example='3712.8'),
  }(name='PriceInfo'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success'),
}

model QueryConvertPrepayInstancePriceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryConvertPrepayInstancePriceResponseBody(name='body'),
}

async function queryConvertPrepayInstancePriceWithOptions(request: QueryConvertPrepayInstancePriceRequest, runtime: Util.RuntimeOptions): QueryConvertPrepayInstancePriceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.convertPrepayInstanceRequest)) {
    bodyFlat['ConvertPrepayInstanceRequest'] = request.convertPrepayInstanceRequest;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryConvertPrepayInstancePrice',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryConvertPrepayInstancePrice(request: QueryConvertPrepayInstancePriceRequest): QueryConvertPrepayInstancePriceResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryConvertPrepayInstancePriceWithOptions(request, runtime);
}

model QueryCreateInstancePriceRequest {
  createInstanceRequest?: {
    architectureType?: string(name='ArchitectureType'),
    autoRenew?: boolean(name='AutoRenew', example='true'),
    chargeType?: string(name='ChargeType', example='PRE'),
    duration?: int32(name='Duration', example='1'),
    extra?: string(name='Extra'),
    ha?: boolean(name='Ha'),
    haResourceSpec?: {
      cpu?: int32(name='Cpu'),
      memoryGB?: int32(name='MemoryGB'),
    }(name='HaResourceSpec'),
    instanceName?: string(name='InstanceName', example='vvp1'),
    pricingCycle?: string(name='PricingCycle', example='Month'),
    promotionCode?: string(name='PromotionCode', example='5ef***'),
    region?: string(name='Region', example='cn-beijing'),
    resourceSpec?: {
      cpu?: int32(name='Cpu', example='10'),
      memoryGB?: int32(name='MemoryGB', example='40'),
    }(name='ResourceSpec'),
    storage?: {
      oss?: {
        bucket?: string(name='Bucket', example='oss_flink'),
      }(name='Oss'),
    }(name='Storage'),
    usePromotionCode?: boolean(name='UsePromotionCode', example='true'),
    vSwitchIds?: [ string ](name='VSwitchIds'),
    vpcId?: string(name='VpcId', description='VPC ID。', example='vpc-2ze9*******nxfmfcdi'),
    zoneId?: string(name='ZoneId', example='cn-beijing-g'),
  }(name='CreateInstanceRequest'),
}

model QueryCreateInstancePriceResponseBody = {
  priceInfo?: {
    code?: string(name='Code', example='ORDER.INST_HAS_UNPAID_ORDER'),
    currency?: string(name='Currency', example='CNY'),
    depreciateInfo?: {
      cheapRate?: string(name='CheapRate'),
      cheapStandAmount?: string(name='CheapStandAmount'),
      isShow?: boolean(name='IsShow'),
      monthPrice?: string(name='MonthPrice'),
      originalStandAmount?: string(name='OriginalStandAmount'),
      startTime?: string(name='StartTime'),
    }(name='DepreciateInfo'),
    discountAmount?: float(name='DiscountAmount', example='655.2'),
    isContractActivity?: boolean(name='IsContractActivity'),
    message?: string(name='Message', example='存在未支付订单，请先支付或取消原有订单'),
    optionalPromotions?: [ 
      {
        promotionDesc?: string(name='PromotionDesc', example='￥1,391.5 优惠券 (有效期至 03/23/2022)'),
        promotionName?: string(name='PromotionName', example='￥1,391.5 优惠券'),
        promotionOptionNo?: string(name='PromotionOptionNo', example='50001122001****'),
        selected?: boolean(name='Selected', example='true'),
      }
    ](name='OptionalPromotions'),
    originalAmount?: float(name='OriginalAmount', example='4368'),
    rules?: [ 
      {
        description?: string(name='Description', example='买满1年，立享官网价格8.5折优惠。'),
        ruleId?: long(name='RuleId', example='102007100514****'),
      }
    ](name='Rules'),
    standDiscountPrice?: string(name='StandDiscountPrice'),
    standPrice?: string(name='StandPrice'),
    tradeAmount?: float(name='TradeAmount', example='3712.8'),
  }(name='PriceInfo'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model QueryCreateInstancePriceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryCreateInstancePriceResponseBody(name='body'),
}

async function queryCreateInstancePriceWithOptions(request: QueryCreateInstancePriceRequest, runtime: Util.RuntimeOptions): QueryCreateInstancePriceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.createInstanceRequest)) {
    bodyFlat['CreateInstanceRequest'] = request.createInstanceRequest;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryCreateInstancePrice',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryCreateInstancePrice(request: QueryCreateInstancePriceRequest): QueryCreateInstancePriceResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryCreateInstancePriceWithOptions(request, runtime);
}

model QueryModifyInstancePriceRequest {
  modifyPrepayInstanceSpecRequest?: {
    ha?: boolean(name='Ha'),
    haResourceSpec?: {
      cpu?: int32(name='Cpu'),
      memoryGB?: int32(name='MemoryGB'),
    }(name='HaResourceSpec'),
    haVSwitchIds?: [ string ](name='HaVSwitchIds'),
    haZoneId?: string(name='HaZoneId'),
    instanceId?: string(name='InstanceId', example='sc_flinkserverless_public_cn-******'),
    region?: string(name='Region', example='cn-beijing'),
    resourceSpec?: {
      cpu?: int32(name='Cpu', example='10'),
      memoryGB?: int32(name='MemoryGB', example='40'),
    }(name='ResourceSpec'),
  }(name='ModifyPrepayInstanceSpecRequest'),
}

model QueryModifyInstancePriceResponseBody = {
  priceInfo?: {
    code?: string(name='Code', example='ORDER.INST_HAS_UNPAID_ORDER'),
    currency?: string(name='Currency', example='CNY'),
    depreciateInfo?: {
      cheapRate?: string(name='CheapRate'),
      cheapStandAmount?: string(name='CheapStandAmount'),
      isShow?: boolean(name='IsShow'),
      monthPrice?: string(name='MonthPrice'),
      originalStandAmount?: string(name='OriginalStandAmount'),
      startTime?: string(name='StartTime'),
    }(name='DepreciateInfo'),
    discountAmount?: float(name='DiscountAmount', example='655.2'),
    isContractActivity?: boolean(name='IsContractActivity'),
    message?: string(name='Message', example='存在未支付订单，请先支付或取消原有订单'),
    optionalPromotions?: [ 
      {
        promotionDesc?: string(name='PromotionDesc', example='￥1,391.5 优惠券 (有效期至 03/23/2022)'),
        promotionName?: string(name='PromotionName', example='￥1,391.5 优惠券'),
        promotionOptionNo?: string(name='PromotionOptionNo', example='500011220010099'),
        selected?: boolean(name='Selected', example='true'),
      }
    ](name='OptionalPromotions'),
    originalAmount?: float(name='OriginalAmount', example='4368'),
    rules?: [ 
      {
        description?: string(name='Description', example='买满1年，立享官网价格8.5折优惠。'),
        ruleId?: long(name='RuleId', example='1020071005141834'),
      }
    ](name='Rules'),
    standDiscountPrice?: string(name='StandDiscountPrice'),
    standPrice?: string(name='StandPrice'),
    tradeAmount?: float(name='TradeAmount', example='3712.8'),
  }(name='PriceInfo'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model QueryModifyInstancePriceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryModifyInstancePriceResponseBody(name='body'),
}

async function queryModifyInstancePriceWithOptions(request: QueryModifyInstancePriceRequest, runtime: Util.RuntimeOptions): QueryModifyInstancePriceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.modifyPrepayInstanceSpecRequest)) {
    bodyFlat['ModifyPrepayInstanceSpecRequest'] = request.modifyPrepayInstanceSpecRequest;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryModifyInstancePrice',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryModifyInstancePrice(request: QueryModifyInstancePriceRequest): QueryModifyInstancePriceResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryModifyInstancePriceWithOptions(request, runtime);
}

model QueryRenewInstancePriceRequest {
  renewInstanceRequest?: {
    duration?: int32(name='Duration', example='1'),
    instanceId?: string(name='InstanceId', example='sc_flinkserverless_public_cn-******'),
    pricingCycle?: string(name='PricingCycle', example='Month'),
    region?: string(name='Region', example='cn-beijing'),
  }(name='RenewInstanceRequest'),
}

model QueryRenewInstancePriceResponseBody = {
  priceInfo?: {
    code?: string(name='Code', example='ORDER.INST_HAS_UNPAID_ORDER'),
    currency?: string(name='Currency', example='CNY'),
    depreciateInfo?: {
      cheapRate?: string(name='CheapRate'),
      cheapStandAmount?: string(name='CheapStandAmount'),
      isShow?: boolean(name='IsShow'),
      monthPrice?: string(name='MonthPrice'),
      originalStandAmount?: string(name='OriginalStandAmount'),
      startTime?: string(name='StartTime'),
    }(name='DepreciateInfo'),
    discountAmount?: float(name='DiscountAmount', example='655.2'),
    isContractActivity?: boolean(name='IsContractActivity'),
    message?: string(name='Message', example='存在未支付订单，请先支付或取消原有订单'),
    optionalPromotions?: [ 
      {
        promotionDesc?: string(name='PromotionDesc', example='￥1,391.5 优惠券 (有效期至 03/23/2022)'),
        promotionName?: string(name='PromotionName', example='￥1,391.5 优惠券'),
        promotionOptionNo?: string(name='PromotionOptionNo', example='500011220010099'),
        selected?: boolean(name='Selected', example='true'),
      }
    ](name='OptionalPromotions'),
    originalAmount?: float(name='OriginalAmount', example='4368'),
    rules?: [ 
      {
        description?: string(name='Description', example='买满1年，立享官网价格8.5折优惠。'),
        ruleId?: long(name='RuleId', example='1020071005141834'),
      }
    ](name='Rules'),
    standDiscountPrice?: string(name='StandDiscountPrice'),
    standPrice?: string(name='StandPrice'),
    tradeAmount?: float(name='TradeAmount', example='3712.8'),
  }(name='PriceInfo'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model QueryRenewInstancePriceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryRenewInstancePriceResponseBody(name='body'),
}

async function queryRenewInstancePriceWithOptions(request: QueryRenewInstancePriceRequest, runtime: Util.RuntimeOptions): QueryRenewInstancePriceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.renewInstanceRequest)) {
    bodyFlat['RenewInstanceRequest'] = request.renewInstanceRequest;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryRenewInstancePrice',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryRenewInstancePrice(request: QueryRenewInstancePriceRequest): QueryRenewInstancePriceResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryRenewInstancePriceWithOptions(request, runtime);
}

model RenewInstanceRequest {
  renewInstanceRequest?: {
    duration?: int32(name='Duration', example='1'),
    instanceId?: string(name='InstanceId', example='sc_flinkserverless_public_cn-7e22ae5****'),
    pricingCycle?: string(name='PricingCycle', example='Month'),
    region?: string(name='Region', example='cn-beijing'),
  }(name='RenewInstanceRequest'),
}

model RenewInstanceResponseBody = {
  orderId?: long(name='OrderId', example='210406354690749'),
  requestId?: string(name='RequestId', example='67F33190-946B-1105-B6A1-E2DF0426DD51'),
  success?: boolean(name='Success', example='true'),
}

model RenewInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RenewInstanceResponseBody(name='body'),
}

async function renewInstanceWithOptions(request: RenewInstanceRequest, runtime: Util.RuntimeOptions): RenewInstanceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.renewInstanceRequest)) {
    bodyFlat['RenewInstanceRequest'] = request.renewInstanceRequest;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RenewInstance',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function renewInstance(request: RenewInstanceRequest): RenewInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return renewInstanceWithOptions(request, runtime);
}

model TagResourcesRequest {
  regionId?: string(name='RegionId', example='cn-beijing'),
  resourceId?: [ string ](name='ResourceId'),
  resourceType?: string(name='ResourceType', example='vvpinstance'),
  tag?: [ 
    {
      key?: string(name='Key', example='test'),
      value?: string(name='Value', example='tag'),
    }
  ](name='Tag'),
}

model TagResourcesResponseBody = {
  code?: string(name='Code', example='200'),
  message?: string(name='Message', example='""'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success', example='true'),
  tagResponseId?: string(name='TagResponseId', example='154FT'),
}

model TagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: TagResourcesResponseBody(name='body'),
}

async function tagResourcesWithOptions(request: TagResourcesRequest, runtime: Util.RuntimeOptions): TagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TagResources',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function tagResources(request: TagResourcesRequest): TagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return tagResourcesWithOptions(request, runtime);
}

model UntagResourcesRequest {
  all?: boolean(name='All', example='false'),
  regionId?: string(name='RegionId', example='cn-beijing'),
  resourceId?: [ string ](name='ResourceId'),
  resourceType?: string(name='ResourceType', example='vvpinstance'),
  tagKey?: [ string ](name='TagKey'),
}

model UntagResourcesResponseBody = {
  code?: string(name='Code', example='200'),
  message?: string(name='Message', example='""'),
  requestId?: string(name='RequestId', example='27AE00'),
  success?: boolean(name='Success', example='true'),
  tagResponseId?: string(name='TagResponseId', example='154FT'),
}

model UntagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UntagResourcesResponseBody(name='body'),
}

async function untagResourcesWithOptions(request: UntagResourcesRequest, runtime: Util.RuntimeOptions): UntagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.all)) {
    query['All'] = request.all;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tagKey)) {
    query['TagKey'] = request.tagKey;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UntagResources',
    version = '2019-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function untagResources(request: UntagResourcesRequest): UntagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return untagResourcesWithOptions(request, runtime);
}

